Modules | Files | Inheritance Tree | Inheritance Graph | Name Index | Config

Module Synopsis:: Parser:: C++:: {link.cc}

Static namespace for link module


Typedefs Summary:
std::map<std::string, std::string>TOC
Type of the TableOfContents [Source]

Structs Summary:
Link
Encapsulation of a link fragment. [Source]

Functions Summary:
 std::ostream&operator<<(std::ostream& o, const Link::Map::value_type& linepair)
Debugging output operator for members of the Link Map [Source]
 voidparse_args(int argc, char** argv)
Parses the command line arguments given to main() [Source]
 voidwrite(std::ostream& out, int col, char* buf, int len, int buflen)
Writes some text to the output. [Source]
 voidwrite_lineno(std::ostream& out, int line)
Writes the line number to the output [Source]
 std::stringdecode(const std::string& str)
Undoes the %FF encoding [Source]
 voidwrite_indent(std::ostream& out, char* buf, int& col, int buflen)
Writes whatever indent there is in the buf to the output using the special span. [Source]
 boolis_duplicate(Link* link, int len)
Returns true if the link is a duplicate. [Source]
 voidread_links()
Reads the links file into the 'links' map. [Source]
 voiddump_links()
Debugging method to dump all links to cout. [Source]
 voidread_tocs()
Reads in the TOC files. [Source]
 voidlink_file()
Reads the input file, inserts links, and writes the result to the output. [Source]

Module variables Summary:
const char*input_filename
Filename of the input source file [Source]
const char*output_filename
Filename of the output HTML file [Source]
const char*links_filename
Filename of the links file [Source]
const char*links_scope
Scope to prepend to links before to find in TOC [Source]
std::vector<std::string>toc_filenames
A list of TOC's to load [Source]
boollinks_append
True if should append to output file. [Source]
Link::Maplinks
A map of links to insert into the output [Source]
TOCtoc
The TOC used for looking up hrefs [Source]

Function Details:
 void write(std::ostream& out, int col, char* buf, int len, int buflen)

Writes some text to the output. It replaces chars that might be confused by HTML, such as < and >. All spaces are replaced with non-breaking spaces, and tabs are expanded to 8-col tabstops (hence the col argument)


 void write_indent(std::ostream& out, char* buf, int& col, int buflen)

Writes whatever indent there is in the buf to the output using the special span. 'col' is modified to the first non-indent character.


 void read_tocs()

Reads in the TOC files. The filenames are taken from the toc_filenames array and store in the 'toc' map.


 void link_file()

Reads the input file, inserts links, and writes the result to the output. It uses the 'links' line map to iterate through the file sequentially.


Module variable Details:
bool links_append

True if should append to output file. Note that this only works if the process previously using the file has flushed things to disk!